<?php
/**
 * File: User.php
 * User: Mr.Yang
 * Date: 2025/4/8 0008
 * Time: 9:34
 * Note:
 */

namespace app\admin\validate;


use think\Validate;

class User extends Validate
{
    protected $rule = [
        'avatar' => 'require',
        'username' => 'require|min:5|alpha',
        'password' => 'require|min:5',
        'rpassword' => 'require|confirm:password',
        'payword' => 'require|min:5',
        'rpayword' => 'require|confirm:payword',
        'truename' => 'require',
        'mobile' => 'require|mobile',
    ];

    protected $message = [
        'avatar.require' => '头像不能为空',
        'username.require' => '账号不能为空',
        'username.min' => '账号不能少于5位',
        'username.alpha' => '账号只能是字母',
        'password.require' => '登录密码不能为空',
        'password.min' => '登录密码不能少于5位',
        'rpassword.require' => '再次登录密码不能为空',
        'rpassword.confirm' => '两次登录密码不一致',

        'payword.require' => '支付密码不能为空',
        'payword.min' => '支付密码不能少于5位',
        'rpayword.require' => '再次支付密码不能为空',
        'rpayword.confirm' => '两次支付密码不一致',

        'truename.require' => '姓名不能为空',
        'mobile.require' => '手机号不能为空',
        'mobile.mobile' => '手机号格式错误',
    ];

    protected $scene = [
        'add' => ['avatar', 'username', 'password', 'rpassword', 'payword', 'rpayword', 'truename', 'mobile'],
        'edit' => ['avatar', 'username', 'truename', 'mobile']
    ];
}